package com.ruoyi.develop.lvFahuomingxi.service.impl;

import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.develop.lvFahuomingxi.mapper.LvFahuomingxiMapper;
import com.ruoyi.develop.lvFahuomingxi.domain.LvFahuomingxi;
import com.ruoyi.develop.lvFahuomingxi.service.ILvFahuomingxiService;

/**
 * 出货通知明细Service业务层处理
 * @author qh
 * @date 2024-09-30
 */
@Service
public class LvFahuomingxiServiceImpl implements ILvFahuomingxiService {
    @Resource
    private LvFahuomingxiMapper lvFahuomingxiMapper;

    /**
     * 查询出货通知明细
     * @param id 出货通知明细主键
     * @return 出货通知明细
     */
    @Override
    public LvFahuomingxi selectById(String id) {
        return lvFahuomingxiMapper.selectById(id);
    }

    /**
     * 查询出货通知明细列表
     * @param entity 出货通知明细
     * @return 出货通知明细
     */
    @Override
    public List<LvFahuomingxi> selectList(LvFahuomingxi entity) {
        return lvFahuomingxiMapper.selectList(entity);
    }

    @Override
    public List<LvFahuomingxi> listHaveCount(LvFahuomingxi entity) {
        return lvFahuomingxiMapper.listHaveCount(entity);
    }

    @Override
    public List<LvFahuomingxi> selectByTogzhiIdGroupByProid(String togzhiId) {
        return lvFahuomingxiMapper.selectByTogzhiIdGroupByProid(togzhiId);
    }

    @Override
    public List<LvFahuomingxi> selectByTogzhiId(String togzhiId) {
        return lvFahuomingxiMapper.selectByTogzhiId(togzhiId);
    }
    /**
     * 新增出货通知明细
     * @param entity 出货通知明细
     * @return 结果
     */
    @Override
    public int insert(LvFahuomingxi entity) {
        if(StringUtils.isBlank(entity.getId())){
            entity.setId(IdUtils.fastSimpleUUID());
        }
                entity.setCreateBy(SecurityUtils.getUsername());
                entity.setCreateTime(DateUtils.getNowDate());
            return lvFahuomingxiMapper.insert(entity);
    }

    /**
     * 修改出货通知明细
     * @param entity 出货通知明细
     * @return 结果
     */
    @Override
    public int update(LvFahuomingxi entity) {
                entity.setUpdateBy(SecurityUtils.getUsername());
                entity.setUpdateTime(DateUtils.getNowDate());
        return lvFahuomingxiMapper.update(entity);
    }

    /**
     * 批量删除出货通知明细
     * @param ids 需要删除的出货通知明细主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return lvFahuomingxiMapper.deleteByIds(ids);
    }

    /**
     * 删除出货通知明细信息
     * @param id 出货通知明细主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return lvFahuomingxiMapper.deleteById(id);
    }

    @Override
    public int updateByFahuoId(String tongzhiId,String tongzhiNo,String isTongzhi) {
        return lvFahuomingxiMapper.updateByFahuoId(tongzhiId,tongzhiNo,isTongzhi);
    }

    @Override
    public int deleteByFahuoId(String tongzhiId) {
        return lvFahuomingxiMapper.deleteByFahuoId(tongzhiId);
    }

}
